package com.alipay.sdk.util;

import java.math.BigDecimal;

/**
 * @ProjectName: 团餐
 * @ClassName: CalculateUtil
 * @Description: java类作用描述
 * @Author: bd-001935
 * @CreateDate: 2022/7/27 11:07 上午
 * @UpdateUser: bd-001935
 * @UpdateDate: 2022/7/27 11:07 上午
 * @UpdateRemark: 更新说明
 * @Version: 1.0
 */
public class CalculateUtil {

    public static double add(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.add(b2).doubleValue();
    }

    public static double multiply(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.multiply(b2).doubleValue();
    }

    public static double subtract(double v1, double v2) {
        BigDecimal b1 = new BigDecimal(Double.toString(v1));
        BigDecimal b2 = new BigDecimal(Double.toString(v2));
        return b1.subtract(b2).doubleValue();
    }

}
